package com.yxhl.zoume.domain.interactor.tripsmgmt;

import com.yxhl.zoume.data.http.repository.tripsmgnt.TripsRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.tripsmgnt.RefundTripParam;
import com.yxhl.zoume.data.http.rest.response.tirps.RefundResponse;
import com.yxhl.zoume.domain.DomainConstants;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by sugarya on 16/4/7.
 */
public class TripRefundUseCase extends com.yxhl.zoume.domain.interactor.base.UseCase<RefundResponse> {

    private TripsRepository tripsRepository;

    @Inject
    public TripRefundUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                             @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                             TripsRepository tripsRepository) {
        super(uiThread, executorThread);
        this.tripsRepository = tripsRepository;
    }

    @Override
    protected Observable<RefundResponse> buildObservable(RequestParamImpl param) {
        return tripsRepository.refundTicket((RefundTripParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
